﻿@model IEnumerable<RedSand.Site.Models.UserInfo>
<div class="panel">
    <div class="panel-header">
        <span>Account manager</span>
    </div>
    <div class="panel-content">
        <div class="panel-toolbar">
            <ul>
                <li>
                    @Ajax.ActionLink("Add", "create", null, AdminAjaxOptions.GetForm, new { @class = "btn-create" })
                </li>
                <li>
                    <a href="#" class="btn-search">Search</a>
                </li>
                <li>
                    @Ajax.ActionLink("Delete all selected", "delete", null, AdminAjaxOptions.DeleteRecords, new { @class = "btn-deletes" })
                </li>
            </ul>
        </div>
        <div class="panel-searchbox">
            @using (Ajax.BeginForm("List", AdminAjaxOptions.Search))
            {
                <div class="form-cell">
                    <label>Keyword</label>
                    @Html.TextBox("Keyword", (string)ViewBag.RouteValues.Keyword)
                </div>  
                <div class="form-cell">
                    <label>Role</label>
                    @Html.Action("GetRoleList", "Role", new { selectedValue = ViewBag.RouteValues.RoleID })
                </div>
                <div class="form-cell">
                    <label>Status</label>
                    @Html.DropDownList("Status", DropDownListHelper.GetStatusList(true, (byte?)ViewBag.RouteValues.Status))
                </div>
                <div class="form-cell width-auto">
                    <input type="submit" value="Search" class="button-small" />
                </div>
                <div class="clear"></div>
            }
        </div>
        @if (Model == null)
        {
            <div class="message warning">Data Empty</div>
        }
        else
        {
            <table class="table-list">
                <thead>
                    <tr>
                        <th class="center width-35">
                            <input type="checkbox" />
                        </th>
                        <th class="width-120">
                            Username
                        </th>
                        <th>
                            Fullname
                        </th>
                        <th>
                            Email
                        </th>
                        <th class="center">
                            Joindate
                        </th>
                        <th class="center width-80">
                            Status
                        </th>
                        <th class="center width-80">
                            Control
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr>
                            <td class="center">
                                <input type="checkbox" value="@item.UserID" />
                            </td>
                            <td>
                                @item.Username
                            </td>
                            <td>
                                @item.Fullname
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Email)
                            </td>
                            <td class="center">
                                @Html.DisplayFor(modelItem => item.JoinDate)
                            </td>
                            <td class="center">
                                @DropDownListHelper.GetStatusString(item.Status)
                            </td>
                            <td class="center">
                                @Ajax.ActionLink("Edit", "edit", new { id = item.UserID }, AdminAjaxOptions.GetForm, new { @class = "btn-edit", title = "Edit" })
                                @Ajax.ActionLink("Delete", "delete", new { id = item.UserID }, AdminAjaxOptions.DeleteRecord, new { @class = "btn-delete", title = "Delete" })
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
            <div class="pager-wrapper">
                @Ajax.Pager((int)ViewBag.TotalRecord, AdminAjaxOptions.Paging, (object)ViewBag.RouteValues)
                <div class="pager-loading-panel">
                </div>
            </div>
        }
    </div>
</div>
